//
//  LLStatus.swift
//  新浪微博
//
//  Created by mac on 16/5/24.
//  Copyright © 2016年 mac.com. All rights reserved.
//

import UIKit

class LLStatus: NSObject {
    //自动匹配机型对应的平台
    //4 4s 5 5c 都是32的
    var id: Int64 = 0
    //微博创建时间
    var created_at: String?
    //微博信息
    var text: String?
    //来源
    var source: String?
    //用户
    var user: LLUser?
    var retweeted_status: LLStatus?
    //配图视图的模型数组
    var pic_urls: [LLPicture]?
    
    //转发的数量
    var reposts_count: Int = 0
    //评论
    var comments_count: Int = 0
    //赞
    var attitudes_count: Int = 0

    init(dict: [String : AnyObject]) {
        super.init()
setValuesForKeysWithDictionary(dict)
    }
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
    override func setValue(value: AnyObject?, forKey key: String) {
        if key == "user"{
            if let dict = value as? [String : AnyObject]{
            user = LLUser(dict: dict)
                }
            return
            }
        
        if key == "retweeted_status"{
            if let dict = value as? [String : AnyObject]{
                retweeted_status = LLStatus(dict: dict)
            }
            return
        }
        if key == "pic_urls"{
            if let array = value as? [[String : AnyObject]]{
                var temp = [LLPicture]()
                for item in array{
                
                  let p = LLPicture(dict: item)
                    temp.append(p)
                }
                pic_urls = temp
            }
            return
        }

         super.setValue(value, forKey: key)
    }
   
    
}
